package ca.etsmtl.log430.lab3.presentation;

import java.util.Observable;

import ca.etsmtl.log430.lab3.gestion.CommonData;
import ca.etsmtl.log430.lab3.gestion.ifaces.ICommonData;
import ca.etsmtl.log430.lab3.presentation.cmdline.Displays;

/**
 * Upon notification, lists the teachers that were read into the vector stored
 * in the CommonData class.
 * 
 * @author A.J. Lattanze, CMU
 * @version 1.3, 2012-Feb-14
 */

/*
 * Modification Log **********************************************************
 * 
 * v1.3, R. Champagne, 2012-Feb-14 - Various refactorings for new lab.
 * 
 * v1.2, R. Champagne, 2011-Feb-24 - Various refactorings, conversion of
 * comments to javadoc format.
 * 
 * v1.1, R. Champagne, 2002-Jun-19 - Adapted for use at ETS.
 * 
 * v1.0, A.J. Lattanze, 12/29/99 - Original version.
 * ***************************************************************************
 */

public class ListTeachers extends Communication {

	/**
	 * @uml.property  name="systemInterface"
	 * @uml.associationEnd  multiplicity="(1 1)"
	 */
	ICommonData systemInterface;
	
	/**
	 * 
	 * @param systemInterface
	 * @param registrationNumber
	 * @param componentName
	 */
	public ListTeachers(ICommonData systemInterface,
			Integer registrationNumber, String componentName) {
		super(registrationNumber, componentName);
		this.systemInterface=systemInterface;
	}

	/**
	 * The update() method is an abstract method that is called whenever the
	 * notifyObservers() method is called by the Observable class. First we
	 * check to see if the NotificationNumber is equal to this thread's
	 * RegistrationNumber. If it is, then we execute.
	 * 
	 * @see ca.etsmtl.log430.lab3.Communication#update(java.util.Observable,
	 *      java.lang.Object)
	 */
	public void update(Observable thing, Object notificationNumber) {

		if (registrationNumber.compareTo((Integer) notificationNumber) == 0) {
			Displays display = new Displays();
			display.displayTeacherList(systemInterface
					.getListOfTeachers());
		}
	}
}
